package cn.android666.remoteservice

import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.util.Log

class RemoteService : Service() {

    override fun onCreate() {
        super.onCreate()
        Log.i("ABCD", "service onCreate")
    }

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        Log.i("ABCD", "service onStartCommand")
        return super.onStartCommand(intent, flags, startId)
    }

    override fun onBind(intent: Intent): IBinder {
        Log.i("ABCD", "service onBind")
        return DzEngine()
    }

    class DzEngine : IDzEngine.Stub() {

        override fun hello(name: String?): String {
            return "$name，你好"
        }

    }

    override fun onUnbind(intent: Intent?): Boolean {
        Log.i("ABCD", "service onUnbind")
        return super.onUnbind(intent)
    }

    override fun onDestroy() {
        Log.i("ABCD", "service onDestroy")
        super.onDestroy()
    }

}